using Bee.Base.Abstractions.Plugin;
using Bee.Base.Models;
using Bee.Base.Models.Plugin;
using Bee.Base.ViewModels;
using CommunityToolkit.Mvvm.Input;
using Ke.Bee.Localization.Localizer.Abstractions;
using Microsoft.Extensions.Options;

namespace Bee.Plugin.First.ViewModels;

public partial class FirstViewModel : PageViewModelBase
{
    private readonly IOptions<AppSettings> _appsetings;
    private readonly ILocalizer _localizer;
    private readonly IPlugin _plugin;

    public FirstViewModel(IOptions<AppSettings> appsetings, ILocalizer localizer, IEnumerable<IPlugin> plugins)
    {
        _appsetings = appsetings;
        _localizer = localizer;
        _plugin = plugins.FirstOrDefault(a => a.PluginName == "First");
    }

    [RelayCommand]
    private void ChangeText()
    {
        var result = _plugin.Execute<MethodParamter, PluginResult>("method1", new MethodParamter() { MethodName = "Hello" });
        if (result.OK == true)
        {
            
        }
    }
}